package com.qdsg.ysg.doctor.ui.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.qdsg.ysg.doctor.R;
import com.qdsg.ysg.doctor.util.UtilString;
import com.rest.response.DicResponse;
import com.rest.response.SickListResponse;

import java.util.List;

import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * @time 2020/11/16 17:22
 */

public class FlowAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    Context mContext;
    List<DicResponse.Dic> list;
    OnItemClickLitener mOnItemClickLitener;
    int Position;
    Boolean isFromHome = true;


    public FlowAdapter(Context context, Boolean isFromHome, List<DicResponse.Dic> list) {
        this.mContext = context;
        this.isFromHome = isFromHome;
        this.list = list;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        Context context = parent.getContext();
        View view = LayoutInflater.from( context )
                .inflate( R.layout.flow_item, parent, false );
        return new ViewHolder( view );

    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
        final ViewHolder myHolder = (ViewHolder) holder;

        myHolder.flowText.setText( "步惊云" );

//        myHolder.itemView.setOnClickListener( new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Intent intent = new Intent( mContext, SearchDoctorActivity.class );
//                intent.putExtra( "deptId", list.get( position ).id );
//                intent.putExtra( "deptName", list.get( position ).name );
//                intent.putExtra( "type", 0 );
//                mContext.startActivity( intent );
//
//            }
//        } );


    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public interface OnItemClickLitener {
        void onItemClick(View view, int position);
    }


    public void setOnItemClickLitener(OnItemClickLitener mOnItemClickLitener) {
        this.mOnItemClickLitener = mOnItemClickLitener;
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.flow_text)
        TextView flowText;

        public ViewHolder(View itemView) {
            super( itemView );
            ButterKnife.bind( this, itemView );
        }
    }

}
